package com.business.activiti.listener;

import org.activiti.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class ApplicationRunnerImpl implements ApplicationRunner {
    @Autowired
    private MyActivitiEventListener myActivitiEventListener;
    @Autowired
    private RuntimeService runtimeService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("项目启动成功后，为activiti注册全局监听事件：com.business.activiti.listener.MyActivitiEventListener");
        runtimeService.addEventListener(myActivitiEventListener);
    }
}
